package com.example.mytayunapi.Service;

import com.example.mytayunapi.Entity.productsInfo;
import com.example.mytayunapi.Mapper.productsInfoMapper;
import com.example.mytayunapi.Vo.RefundProductsOrders;
import com.example.mytayunapi.Vo.UserProductImage;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class productsInfoServiceImpl implements productsInfoService{
    @Autowired
    private productsInfoMapper productsinfoMapper;


    @Override
    public Integer deleteRefund(String Refund_id) {
        Integer i= productsinfoMapper.deleteRefund(Refund_id);
        return i;
    }

    @Override
    public List<RefundProductsOrders> findRefundProductsOrdersBySchoolDegree(String School_degree) {
        return productsinfoMapper.findRefundProductsOrdersBySchoolDegree(School_degree);
    }


    @Override
    public List<productsInfo> findByCategoryAndstatus(String category) {
        return productsinfoMapper.findByCategoryAndstatus(category);
    }

    @Override
    public List<productsInfo> findByCategory(String category) {
        return productsinfoMapper.findByCategory(category);
    }

    @Override
    public List<productsInfo> getDownProducts() {
        return productsinfoMapper.getDownProducts();
    }

    @Override
    public Integer updateProductStatus(productsInfo productsinfo) {
        return productsinfoMapper.updateProductStatus(productsinfo);
    }

    @Override
    public List<productsInfo> getInfoByReleaseStatus() {
        return productsinfoMapper.getInfoByReleaseStatus();
    }



    @Override
    public List<UserProductImage> getImageUserProduct() {
        return productsinfoMapper.getImageUserProduct();
    }

    @Override
    public List<productsInfo> getProductsInfoByReleaseStatus(String Release_status) {
        return productsinfoMapper.getProductsInfoByReleaseStatus(Release_status);
    }

    @Override
    public Integer insertProductsInfo(productsInfo productsinfo) {
        return productsinfoMapper.insertProductsInfo(productsinfo);
    }

    @Override
    public List<UserProductImage> getImageUserProductId(Integer Product_id){
        return productsinfoMapper.getImageUserProductId(Product_id);
    }

    @Override
    public Integer updateProductsInfoByProductId(UserProductImage productsStatusInfo) {
        return productsinfoMapper.updateProductsInfoByProductId(productsStatusInfo);
    }

//    @Override
//    public List<productsInfo> getmaijiaProductByCategory(String category) {
//        return productsinfoMapper.getmaijiaProductByCategory(category);
//    }


    @Override
    public PageInfo<UserProductImage> getPageInfo(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<UserProductImage> UserProductImage = productsinfoMapper.getImageUserProduct();
        PageInfo<UserProductImage> pageInfo = new PageInfo<>();
        return pageInfo;
    }//上架商品审核分页

    @Override
    public PageInfo<productsInfo> getPageInfos(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<productsInfo>  productsInfos = productsinfoMapper.getInfoByReleaseStatus();
        PageInfo<productsInfo> pageInfo = new PageInfo<>();
        return pageInfo;
    }//在售商品分页

    @Override
    public PageInfo<productsInfo> getPageInfoU(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<productsInfo>  productsInfos = productsinfoMapper.getInfoByReleaseStatus();
        PageInfo<productsInfo> pageInfo = new PageInfo<>();
        return pageInfo;
    }//下架商品分页

    @Override
    public List<UserProductImage> getImageUserProductByReleaseStatus(String Release_status) {
        return productsinfoMapper.getImageUserProductByReleaseStatus(Release_status);
    }

    @Override
    public List<UserProductImage> getImageUserProductByReleaseStatusNot(String Release_status) {
        return productsinfoMapper.getImageUserProductByReleaseStatusNot(Release_status);
    }

    @Override
    public List<UserProductImage> getImageUserProductByReleaseStatusAndId(String Release_status, Integer Product_id) {
        return productsinfoMapper.getImageUserProductByReleaseStatusAndId(Release_status, Product_id);
    }

    @Override
    public List<UserProductImage> getImageUserProductByReleaseStatusAndIdProAcate(String category, String subcategory, String keyword) {
        return productsinfoMapper.getImageUserProductByReleaseStatusAndIdProAcate(category, subcategory, keyword);
    }

    @Override
    public List<UserProductImage> getImageUserProductByRelease() {
        return productsinfoMapper.getImageUserProductByRelease();
    }//

    @Override
    public List<UserProductImage> getImageUserProductByCategory(String category) {
        return productsinfoMapper.getImageUserProductByCategory(category);
    }

    @Override
    public List<UserProductImage> getImageUserProductBySubcategory(String subcategory) {
        return productsinfoMapper.getImageUserProductBySubcategory(subcategory);
    }

    @Override
    public List<UserProductImage> getImageUserProductByKeyword(String keyword) {
        return productsinfoMapper.getImageUserProductByKeyword(keyword);
    }

    @Override
    public Integer insertProducts(productsInfo productsinfo) {
        return productsinfoMapper.insertProducts(productsinfo);
    }

    @Override
    public List<UserProductImage> getmaijiaProductByProductId(Integer Product_id) {
        return productsinfoMapper.getmaijiaProductByProductId(Product_id);
    }

    @Override
    public productsInfo saveProduct(productsInfo product) {
        productsinfoMapper.insertProduct(product);
        return product;
    }

    @Override
    public List<productsInfo> getProductByKeyword(String keyword) {
        return productsinfoMapper.getProductByKeyword(keyword);
    }

    @Override
    public List<Map<String, Object>> getEchartCake() {
        return productsinfoMapper.getEchartCake();
    }

    //分页
//    @Override
//    public PageInfo<productsInfo> getPageInfo(int pageNum, int pageSize) {
//        PageHelper.startPage(pageNum, pageSize);
//        List<productsInfo> productsInfo = productsinfoMapper.getImageUserProduct();
//        PageInfo<productsInfo> pageInfo = new PageInfo<>();
//        return pageInfo;
//    }




//    @Override
//    public List<UserProductImage> getProductsInfoByProductName(String Product_name, Timestamp Product_time) {
//        return productsinfoMapper.getProductsInfoByProductName(Product_name,Product_time);
//    }

}
